import 'babel-polyfill'
import Vue from 'vue'

import 'normalize.css/normalize.css'// A modern alternative to CSS resets
import Element from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import contentmenu from 'v-contextmenu'
import 'v-contextmenu/dist/index.css'
import Pagination from '@/components/Pagination'
import CustomCard from '@/components/CustomCard'
import UploadImage from '@/components/Upload/index'
import UploadFile from '@/components/Upload/file'
import ImgList from '@/components/ImgListView/index'
import Cancel from '@/components/confirm/cancel'
import htmlToPdf from '@/utils/htmlToPdf'


import '@/styles/index.scss' // global css

import App from './App'
import router from './router'
import store from './store'

import i18n from './lang' // Internationalization
import './icons' // icon
import './errorLog'// error log
import './permission' // permission control
// import './mock' // simulation data

import * as filters from './filters' // global filters

Vue.use(Element, {
  size: 'medium', // set element-ui default size
  i18n: (key, value) => i18n.t(key, value)
})

Vue.use(contentmenu)
Vue.use(htmlToPdf)
Vue.component(Pagination.name, Pagination);
Vue.component(CustomCard.name, CustomCard);
Vue.component(UploadImage.name, UploadImage);
Vue.component(UploadFile.name, UploadFile);
Vue.component(ImgList.name, ImgList);
Vue.prototype.cancel = Cancel;

// register global utility filters.
Object.keys(filters).forEach(key => {
  Vue.filter(key, filters[key])
})

Vue.config.productionTip = false

new Vue({
  el: '#app',
  router,
  store,
  i18n,
  template: '<App/>',
  components: { App }
})
